﻿<Window x:Class="Wpfконфигуратор.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:this="clr-namespace:Wpfконфигуратор"
        xmlns:конфигуратор="clr-namespace:конфигуратор;assembly=конфигуратор" 
        Title="Диспетчер" Background="AliceBlue" Margin="3" SizeToContent="Manual"  Loaded="Window_Loaded"
        mc:Ignorable="d"
        d:DesignHeight="521" d:DesignWidth="871" >
    <Window.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Window1"/>
        </ContextMenu>
    </Window.ContextMenu>
    
    
    <DockPanel  Name="stackPanelНижняя" Background="#FF9EBE9E"     >

        <TextBox FontSize="12" SpellCheck.IsEnabled="True"  DockPanel.Dock="Bottom" Name="textBox1"  Margin="3" 
                 Padding="3" TextWrapping="Wrap" AcceptsReturn="True" 
                 AutoWordSelection="True" MinLines="3" MaxLines="10" VerticalScrollBarVisibility="Auto" 
                 HorizontalScrollBarVisibility="Auto" />

        <Grid Name="grid1"   DockPanel.Dock="Top" DataContext="{Binding ElementName= СписокОбъектов, Path=SelectedItem}">
            <Grid.Resources>
                <DataTemplate x:Key="паспорт" DataType="{x:Type конфигуратор:Паспорт}" >
                    <Border Margin="3" BorderThickness="1" BorderBrush="SteelBlue" CornerRadius="3" MouseMove="ListBoxItemDragMove">
                        <Grid Margin="3">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            
                            <TextBlock Text="{Binding Path=Имя, UpdateSourceTrigger=PropertyChanged}" />
                            <TextBlock Grid.Row="1" Text="{Binding Path=Тип}" />
                            
                        </Grid>
                    </Border>
                </DataTemplate>
            </Grid.Resources>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="161*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="531*" />
            </Grid.ColumnDefinitions>
            
            <ListBox Name="ListBoxСписокОбъектов" MinWidth="100" HorizontalContentAlignment="Stretch"
                         ItemTemplate="{StaticResource ResourceKey=паспорт}"
                         AllowDrop="True"
                         SelectionChanged="СписокОбъектов_SelectionChanged" 
                        
                           Drop="ПаспортDropHandler" PreviewMouseRightButtonUp="ListBoxСписокОбъектов_PreviewMouseRightButtonUp">
                <ListBox.CommandBindings>
                    <CommandBinding Command="Delete" Executed="CommandBinding_Executed_Удалить" CanExecute="CommandBinding_CanExecute_Удалить" />
                </ListBox.CommandBindings>
                        
               
                <ListBox.ContextMenu>
                    <ContextMenu >
                        <MenuItem Header="Добавить"  Click="MenuItem_Click_Добавить" />
                        <MenuItem Header="Редактировать" Click="MenuItem_Click_Редактировать" />
                        <MenuItem Command="ApplicationCommands.Delete" Header="Удалить" />
                    </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>

            <GridSplitter Background="#FF9EBE9E" ShowsPreview="False"  HorizontalAlignment="Center"  Name="gridSplitter1"  Width="7" Grid.Column="1"  />
            <TabControl Grid.Column="2" >
                <TabItem Name="tabControlПаспорт" Header="паспорт">
                    <this:ПаспортВид  Margin="10"/>
                </TabItem>
                
                <TabItem Header="Редактор">
                    <this:Редактор x:Name="Редактор1"  />
                </TabItem>

            </TabControl>
            
                
        </Grid>

    </DockPanel>
</Window>
